
<?php 
     @session_start();
     include 'clsGiangVien.php';
     $gv = new GiangVien();
     if(empty($_SESSION['gv'])){
     	header("Location: gv-dangnhap.php");
     }
     $magv = $_SESSION['gv'];
     /*
	 $sql=mysql_query("select curdate() from dual");
	 $d=mysql_fetch_row($sql);
	 $date=$d[0];
	 $sql1=mysql_query("select * from `thoi gian danh gia` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`) and congviec='GV'");
	 $r=mysql_fetch_row($sql1);
	 $bd=$r[0];
	 $kt=$r[1];
	 if( ($date >= $bd) && ($date <= $kt))
	 { */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Trang Đăng nhập của Giảng viên</title>
<style type="text/css">
<!--
a	{
		color: #006600;
		text-decoration: none;
	}

a:hover { COLOR: #CC0000}

.style1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 30px;
}
.style2 {
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
  
}
.style3 {
	font-size: 16px;
	color: #FFFFFF;
  
}
.style4 {color: #006600; font-weight: bold; font-size: 18px; }
.style5 {color:#0000000; font-weight: bold; font-size: 18px; }
.mo { color:#CC0000; font-size:18px}

-->
</style>
</head>

<body>
<script type="text/javascript">
function check()
{
	if(f.matruycap.value=="")
	{
		alert("Xin vui lòng nhập vào mã truy cập!");
		f.taikhoan.focus();
		return false;
	}
	if(f.taikhoan.value.length>0)
	{	
		for(i=0;i<f.taikhoan.value.length;i++)
		{
			if(f.taikhoan.value.charAt(i)==' ')
			{
				alert("Mã truy cập không được chứa khoảng trắng");
				f.taikhoan.value="";
				f.taikhoan.focus();
				return false;
			}
		}
	}
	
	return true;
}
</script>
<?php $message = "";
	if(isset($_POST['dn'])){
		if(!empty($_GET['mahocphan']) && !empty($_GET['nhomhocphan']) && !empty($_GET['hocki']) && !empty($_GET['namhoc'])
		&& !empty($_SESSION['gv']) && isset($_POST['matruycap'])){
			$gv->setMaTruyCap($_GET['mahocphan'], $_GET['nhomhocphan'], $_GET['hocki'], $_GET['namhoc'], $_SESSION['gv'], $_POST['matruycap']);
			$message = '<p style="color: green">Đặt mã truy cập thành công!</p>';
		} else $message = '<p style="color: red">Quá trình thất bại. Vui lòng thử lại!</p>';
	}
?>
<table width="900" height="600" border="0" bordercolorlight="#CCCCCC"  align="center" cellpadding="0" cellspacing="0"style="border:1px solid #0066FF" >

<!-- đầu trang --> 	
    <tr> <td width="900px" height="70" background="../image/header.gif">
    	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr>
       		<td width="10%"><img src="../image/logo.gif" width="100%" height="70" /></td>
            <td style="font-size:24px" width="90%">
            	<div align="center"><blockquote>
                	<span class="style1" id="style1">WEBSITE GHI NHẬT KÍ HỌC PHẦN</span></blockquote>
                </div>
            </td>
       	 </tr>
       	 <tr>
       	 <?php 
			if(isset($_SESSION['gv']) && !empty($_SESSION['gv'])){
				$session = $_SESSION['gv'];
				//echo $session;
				$taikhoan = $gv->getTenGV($session);
			
			}?>
				<td width="32%" valign="bottom" colspan="2" align="right"> <table>
					  <tr><td valign="bottom">
				  			<div align="center" class="style3">Xin chào <?php echo $taikhoan[0][0]; ?> </div></td>
		  			  </tr> 
					  <tr><td valign="bottom">
					  <div align="center" class="style3" style="margin-right: 10px">
						<a class="style3" href="../logout.php">Thoát</a></div></td></tr>
					  
				       </table>
			    </td> 
			</tr></table>
    </td> </tr>
	<tr><td height="100">&nbsp; </td></tr>

<!-- thân trang -->  	
    <tr> <td valign="top" bordercolor="#FFFFFF" height="400">
    	<form name="f" method="post" action="" onSubmit="return check()">
				  <table width="400"  border="0"  align="center" style="border:1px solid #0066FF" cellpadding="0" cellspacing="0">
				  
				  
				        <tr bordercolor="#FFFFFF"> 
        	                  <td height="35" colspan="2" align="center" background="../image/bg_header.gif">
            	<span style="font-size:20px; color:#FFFFFF; font-weight:bold;">Đặt Mã Truy Cập</span>
				             </td>
       	                
						</tr>
						
						<tr height="10"  bordercolor="#FFFFFF" >  
							  <td   align="center" colspan="2">
								<?php echo $message; ?>
							  </td>
							    
						</tr>
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td  style="font-size:18px; " align="center" width="200">
									Mã truy cập:
							  </td>
							  <?php if(!empty($_GET['mahocphan']) && !empty($_GET['nhomhocphan']) && !empty($_GET['hocki']) && !empty($_GET['namhoc'])
							  			&& !empty($_SESSION['gv'])){
							  			$matruycap = $gv->getMaTruyCap($_GET['mahocphan'], $_GET['nhomhocphan'], $_GET['hocki'], $_GET['namhoc'], $_SESSION['gv']);
							  		}
							  	?>
							  <td  align="left" width="200">
									<input type="text" name="matruycap" id="matruycap" value="<?php if($matruycap != null) echo $matruycap[0][0]; ?>" />
							  </td>
							  
						</tr>
						
						<tr height="30"  bordercolor="#FFFFFF" >  
							  <td   align="right" >
									<input type="submit" name="dn" value="Đồng Ý" />
							  </td>
							  <td   align="left" >
									<input type="reset" name="rs" value="Làm lại" />
							  </td>
							    
						</tr>	
							
					
						<tr height="10"  bordercolor="#FFFFFF" >  
							  <td   align="center" colspan="2">
						
							  </td>
							    
						</tr>	
					   
				</table>
		</form>
    </td> </tr>

<!-- cuối trang -->  
	<tr> 
	      <td height="28" background="../image/footer.gif" class="style3" align="center" > Copyright @ 2012 by Nhóm phát triển </a>
	     </td>
    </tr>
<!-- het cuoi trang-->

</table>

</body>
</html>
<?php
/* }
else
{
       echo  "<script language='javascript'> alert('Đã hết thời gian đánh giá') </script>";
	   echo '<meta http-equiv="refresh" content="0; URL=trangchu.php" />';
} */
?>
